<?php



function convertDate($date)
    {
         list($ad, $md, $jd) = explode("-", $date); 
         $dt=$ad."-".$md."-".$jd;
        return $dt;
    }
    
    
    function recupIdPersonne($nomP,$table1)
    {
       include 'connexion (2).php';
       list($n, $p) = explode(" ", $nomP); 
       
       $table=strtoupper($table1);
       $rep=""; 
       
        $req="select * from ".$table1.", personne where ".$table.".ID".$table."=personne.IDPERSONNE and NOMPERSONNE='".$n."' and PRENOMPERSONNE='".$p."'"; 
         
        $req_lect=$connexion->query($req);
        
        if($recup=$req_lect->fetch(PDO::FETCH_ASSOC))
        {
            $rep=$recup["ID".$table];
            
        }
       
        
       return $rep;
    }
    
    function recupAdresse($idENT)
    {
       //$rep2="";
       include 'connexion (2).php';
      
        $req2="select * from entreprise where IDENTREPRISE=".$idENT; 
         
        $req_lect2=$connexion->query($req2);
        var_dump($req_lect2);
        $recup2="";
        if($recup2=$req_lect2->fetch(PDO::FETCH_ASSOC))
        {
            $rep2=$recup2["ADRESSEENTREPRISE"];
            
        }
       
        
       return $rep2;
    }
    
?>
